Skip to content

fix: restore snap and imported srps when changing password #15237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 19, 2025

Conversation

montelaidev
Copy link
Contributor

@montelaidev montelaidev commented May 8, 2025

Description

This PR adds the restoration of first party snap accounts and imported srps when changing password.

Changes:

  1. added restoreImportedSrp restoreSnapAccounts to Vault.js and updated the change password logic to use these.
  2. Added new tests to Vault
  3. Fix deadlock that could happen when awaiting a promise in MultichainSnapClient.

Related issues

Fixes: #15258
Fixes: #15233
Resolves: https://consensyssoftware.atlassian.net/browse/MMMULTISRP-208?atlOrigin=eyJpIjoiMmM0MDMzNDRlYzdlNDJmZTg3ODNhMzUzNzlkOWZmZDIiLCJwIjoiaiJ9

Manual testing steps

  1. Using a fresh wallet.
  2. Create a new solana account
  3. Import a private key
  4. Import a qr hardware wallet
  5. import a ledger wallet
  6. Go to settings --> security
  7. Go through change password
  8. Login to the wallet and see that accounts are still there.

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

github-actions bot commented May 8, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@montelaidev montelaidev added the Run Smoke E2E Requires smoke E2E testing label May 9, 2025
@montelaidev montelaidev marked this pull request as ready for review May 9, 2025 09:33
Copy link
Contributor

github-actions bot commented May 9, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 7a14c1b
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/402ab50f-d62e-48e4-bed7-6afeb9ee42ed

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@montelaidev montelaidev added Run Smoke E2E Requires smoke E2E testing and removed Run Smoke E2E Requires smoke E2E testing labels May 9, 2025
Copy link
Contributor

github-actions bot commented May 9, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 9926d8b
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/7a7e9c4f-75b0-414e-992f-5e1e0fcd276f

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@Andepande Andepande added the QA Passed QA testing has been completed and passed label May 9, 2025
@owencraston
Copy link
Contributor

Testing summary

  • I was unable to test hardware wallets due to QR hardware connections being broken and not having access to a ledger device
  • In general this feature is working in the sense that the accounts are restored however there are some querks.

Issue 1:

  • when changing passwords with both Solana accounts and multiple SRPs, the network switched popup shows Solana and then Ethereum while the vault is being recreated. There is nothing really wrong with this but its an unnecessary behaviour and is likely slowing down the app.
  • This is likely not a result of this PR and more the event driven architecture so we do not need to address this in the PR.

Issue 2:

  • The accounts are all recreated but the names and indexing is all messed up. As you can see in my before/after screenshot, account 3 (0xbe4)was selected prior to the password change. After the password was changed, the same address is selected (0xbe4) but the name has changed from account 3 to account 2. This is quite confusing, especially when you have many accounts. I tested with 15 accounts before this and the results were even weirder. Yes the data is still present but the user might be confused by the name change.

Issue 3:

  • Custom account names are not persisted accross password changes.
  • I tested main and this seems to also be the case on main so this is not a blocker. Just something to call out.

Run 1

Before

After

Run 2

Before

After

Copy link
Contributor

@owencraston owencraston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me. Once we get some clarity on the UX "issues" then we can move forward. Unless we feel that the account name changes are a blocker then more code chages will be required.

@Tlees-MMI
Copy link

Issue 1) That is fine for now given the issue we're trying to solve. I'll make note of it in a ticket

@Tlees-MMI
Copy link

Issue 2) We accept the wonky indexing here given the problem we are trying to solve. Spoke about this with @montelaidev and we would need additional logic.

Given we will have more structured hierarchies in ~1 month, I am not as worried about this problem in the immediate term. Especially since it is not a well-worn user flow

@Tlees-MMI
Copy link

Tlees-MMI commented May 15, 2025

Issue #3) Similar feeling to #2. We merge but I'll write a ticket for it

owencraston
owencraston previously approved these changes May 15, 2025
@owencraston owencraston added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@owencraston owencraston added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@owencraston owencraston added this pull request to the merge queue May 16, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 16, 2025
@gantunesr gantunesr added this pull request to the merge queue May 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 17, 2025
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 86.44068% with 8 lines in your changes missing coverage. Please review.

Project coverage is 69.06%. Comparing base (8351137) to head (9bc477d).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
app/core/Vault.js 85.45% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15237      +/-   ##
==========================================
+ Coverage   68.98%   69.06%   +0.08%     
==========================================
  Files        2408     2409       +1     
  Lines       51681    51728      +47     
  Branches     7779     7777       -2     
==========================================
+ Hits        35652    35727      +75     
+ Misses      13737    13709      -28     
  Partials     2292     2292              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@montelaidev montelaidev added this pull request to the merge queue May 19, 2025
Merged via the queue into main with commit 8897c2c May 19, 2025
41 checks passed
@montelaidev montelaidev deleted the fix/mmmultisrp-208 branch May 19, 2025 13:58
@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2025
@metamaskbot metamaskbot added the release-7.48.0 Issue or pull request that will be included in release 7.48.0 label May 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
QA Passed QA testing has been completed and passed release-7.48.0 Issue or pull request that will be included in release 7.48.0 Run Smoke E2E Requires smoke E2E testing team-accounts
Projects
None yet
8 participants